package com.enation.app.javashop.core.client.fallback.distribution;

import com.enation.app.javashop.core.client.feignimpl.distribution.BillMemberClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.distribution.dos.DistributionOrder;
import com.enation.app.javashop.model.distribution.dos.DistributionOrderDO;
import org.springframework.stereotype.Component;

/**
 *  结算相关熔断factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 13:32
 **/
@Component
public class BillMemberClientFallbackFactory extends BaseFallbackFactory<BillMemberClientFeignImpl> {
    @Override
    protected BillMemberClientFeignImpl fallback() {
        return new BillMemberClientFallback();
    }

    /**
     * 结算相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 上午8:17
     * @since v7.0
     */
    @Component
    public static class BillMemberClientFallback implements BillMemberClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public void buyShop(DistributionOrderDO order) {
            logger.error("购买商品产生结算错误,订单为" + order.getOrderSn());
        }

        @Override
        public void returnShop(DistributionOrder distributionOrder) {
            logger.error("退货商品产生结算错误,订单为" + distributionOrder.getOrder().getOrderSn());
        }

    }
}
